<style>
    #operationAreaManage {
        width: 100%;
        min-width: 890px;
        position: relative;
    }

    #operationAreaManage .demo-table-expand {
        font-size: 0;
    }

    #operationAreaManage .demo-table-expand label {
        width: 90px;
        color: #99a9bf;
    }

    #operationAreaManage .demo-table-expand .el-form-item {
        margin-right: 0;
        margin-bottom: 0;
        width: 80%;
    }

    #operationAreaManage .el-table__expand-column .el-table__expand-icon {
        height: 39px;
    }

    #operationAreaManage .table {
        transition: 1s all;
    }

    #operationAreaManage .el-carousel__container {
        height: 440px;
    }

    .el-tooltip__popper {
        max-width: 400px;
    }

    .el-step__main {
        max-width: calc(100% - 60px);
    }

    #operationAreaManage .operationAreaManageTable {
        width: 95% !important;
        margin: 10px 20px 0;
    }

    #operationAreaManage .datePicker {
        width: 140px !important;
        height: 24px !important;
        margin-top: 29px;
        margin-right: 18px;
        float: left;
    }

    #operationAreaManage .datePicker .el-input__inner {
        border-radius: 2px !important;
        height: 24px !important;
    }

    #operationAreaManage .add {
        background: url("/static/images/add.png") no-repeat center;
    }

    #operationAreaManage .del {
        background: url("/static/images/del.png") no-repeat center;
    }

    #operationAreaManage .search {
        background: url("/static/images/search.png") no-repeat center;
    }

    #operationAreaManage .sel {
        background: url("/static/images/sel.png") no-repeat center;
    }

    #operationAreaManage .icon {
        float: left;
    }

    #operationAreaManage .btn span {
        float: left;
        margin-top: 4px;
        margin-left: 2px;
    }
    #operationAreaManage .btn {
        height: 24px;
        line-height: 1;
        border: none;
        background: #f8fafb;
        outline: none;
        cursor: pointer;
        padding: 0;
        margin: 0;
        float: left;
        font-size: 14px;
        color: #1f2d3d;
        margin-top: 29px;
        margin-right: 16px;
    }

    #operationAreaManage .btn-print {
        margin-right: 0;
    }

    #operationAreaManage .btn:hover {
        color: #5468ee;
    }

    #operationAreaManage .inner {
        margin: 0 20px;
    }

    #operationAreaManage .btn-nav {
        height: 60px;
        overflow: hidden;
    }

    #operationAreaManage .btn-nav .el-input .el-input__inner {
        height: 24px;
    }

    #operationAreaManage .btn-nav .el-input {
        float: left;
        margin-top: 29px;
        margin-right: 18px;
        width: 140px;
        height: 24px;
    }

    #operationAreaManage h4 {
        padding-left: 20px;
        margin-bottom: 0px;
    }

    #operationAreaManage .formBottom {
        margin-top: 10px;
    }

    #operationAreaManage .operationAreaManageCombinationDetails .el-date-editor.el-input {
        width: 100%;
    }

    #operationAreaManage .operationAreaManageCombinationDetails {
        margin-top: 30px;
    }
</style>
<style>
    .steps {
        position: absolute;
        bottom: 10px;
        left: 30px;
        margin: auto;
    }

    .el-dialog__headerbtn {
        position: absolute;
        right: 25px;
        top: 15px;
    }

    .el-step__main {
        margin-left: -8px !important;
    }
</style>
<style>
    .el-date-editor.el-input {
        width: 100%;
    }
</style>

<div id="operationAreaManage">
    <!--页面调整-->
    <el-row
            v-loading="showLoading"
            element-loading-text="拼命加载中">
        <div class="inner btn-nav">

            <el-input
                    v-model="blsName"
                    icon="search"
                    placeholder="作业区名称"></el-input>
            <!--<button @click="newInput" class="btn btn-add"><i-->
                    <!--class="icon add"></i><span>新增</span>-->
            <!--</button>-->
            <button
                    class="btn"
                    v-show="multiSelect&&multipleSelection.length==1"
                    @click="multiOperationEdit">编辑
            </button>

        </div>
        <el-table
                :data="operationAreaManage"
                :max-height="config_table_height()"
                ref="table"
                class="operationAreaManageTable"
                @selection-change="multiSelectionChange"
                style="width: 100%">
  
          <el-table-column
              width="80"
              type="index">
          </el-table-column>
            <!--<el-table-column-->
                    <!--type="expand">-->
                <!--<template scope="props">-->
                    <!--<el-row>-->
                        <!--<el-col :span="10">-->
                            <!--<el-form label-position="left" inline class="demo-table-expand">-->
                                <!--<el-form-item label="作业区名称">-->
                                    <!--<span>{{ props.row.blsName        }}</span>-->
                                <!--</el-form-item>-->
                            <!--</el-form>-->
                        <!--</el-col>-->
                        <!--<el-col :span="14">-->
                            <!--<el-form label-position="left" inline class="demo-table-expand">-->
                                <!--<el-form-item label="库位数">-->
                                    <!--<span>{{ props.row.locationCount  }}</span>-->
                                <!--</el-form-item>-->
                                <!--<el-form-item label="可用操作">-->
                                    <!--<el-button-->
                                            <!--size="small"-->
                                            <!--icon="edit"-->
                                            <!--@click="inlineEdit(props.$index, props.row)">-->
                                    <!--</el-button>-->

                                    <!--<el-button-->
                                            <!--size="small"-->
                                            <!--icon="delete"-->
                                            <!--type="danger"-->
                                            <!--@click="deleteOlder(props.$index, props.row)">删除-->
                                    <!--</el-button>-->

                                <!--</el-form-item>-->
                            <!--</el-form>-->
                        <!--</el-col>-->
                    <!--</el-row>-->
                <!--</template>-->
            <!--</el-table-column>-->
            <el-table-column
                    label="作业区名称"
                    show-overflow-tooltip
                    align="center">
                <template scope="scope">
                    <span>{{ scope.row.blsName}}</span>
                </template>
            </el-table-column>
            <el-table-column
                    label="库位数"
                    align="center">
                <template scope="scope">
                    <span>{{ scope.row.locationCount}}</span>
                </template>
            </el-table-column>
            <el-table-column
                    v-if="multiSelect"
                    type="selection"
                    width="60">
            </el-table-column>

        </el-table>
        <div class="block">
            <el-pagination
                    @size-change="handleSizeChange"
                    @current-change="handleCurrentChange"
                    :current-page="currentPage"
                    :page-sizes="[5, 10, 15, 20, 100, 500, 1000, 5000, 10000]"
                    :page-size="pageSize"
                    layout="total, sizes, prev, pager, next, jumper"
                    :total="currentTotal">
            </el-pagination>
        </div>
    </el-row>
    <el-dialog
            size="large"
            v-model="dialogFormVisible">
        <div class="dialog-title clearfix" slot="title">
            <span class="el-dialog__title">{{form.title}}</span>

        </div>
        <el-form :model="form" ref="newForm">
            <el-carousel
                    ref="carousel"
                    :autoplay="false"
                    arrow="never"
                    indicator-position="none"
                    height="55vh">
                <el-carousel-item>
                    <el-row>
                        <el-col :span="10">
                            <el-form-item
                                    label="作业区名称"
                                    :label-width="formLabelWidth">
                                <el-input
                                        v-model.number="form.blsName"
                                        auto-complete="off"></el-input>
                            </el-form-item>
                            <el-form-item
                                    label="库位数"
                                    :label-width="formLabelWidth">
                                <el-input
                                        auto-complete="off"></el-input>
                            </el-form-item>
                        </el-col>

                    </el-row>
                </el-carousel-item>

            </el-carousel>
        </el-form>
        <div slot="footer" class="dialog-footer">
            <el-button type="primary" @click="submitRole" :loading="loadingWarehouse">保存
            </el-button>
        </div>

    </el-dialog>

</div>

<script>
    var operationAreaManage = new Vue({
        el: '#operationAreaManage',
        prop: {},
        data: function () {
            return {
                operationAreaManage: [],      //主页面 信息集合
                multipleSelection: [],           //主页面 多选集合
                multiSelect: false,              //主页面 多选状态 维护
                blsName: '',                  //TODO 主页面 作业区名称    搜索
                showLoading: false,              //主页面 加载 维护

                currentPage: 1,                  //分页 当前页
                currentTotal: 1,                 //分页 总页数
                pageSize: 10,                    //分页 分页大小

                formLabelWidth: '120px',         //表单 配置

                form: form(),                    //新建 弹出层 信息集合
                dialogFormActive: 0,             //新建 弹出层 steps 当前进度
                dialogFormVisible: false,        //新建 弹出层 是否可见
                submitLoading: false,            //新建 弹出层 提交等待

                pickerOption: {
                    disabledDate: function (time) {
                        return time.getTime() > Date.now();
                    }
                },             //新建 弹出层 相对湿度选项

                dialogRoleVisible: false,        //仓库管理 弹出层 是否可见
                loadingWarehouse: false,         //仓库管理 弹出层 提交等待
                role: [],                        //仓库管理 集合
                warehouseForm: {

                },            //仓库管理 弹出层 信息集合

            }
        },
        computed: {
            option: function () {
                return {
                    "draw": 1,
                    "pageNum": this.currentPage,
                    "pageSize": this.pageSize,
                    "blsName":this.blsName.trim()
                }
            },           //主页面 post 0
        },
        methods: {
            inlineEdit: function (index, row) {
                this.form.title = '编辑';
                this.form.blsName = row.blsName;
                this.form.a = row.a;
                this.form.ruStatus = parseInt(row.ruStatus);
                this.dialogFormVisible = true;
                this.dialogFormActive = 0;
                Vue.nextTick(function () {
                    operationAreaManage.$refs.carousel.setActiveItem(0);
                });
            },                                  //TODO 行内按钮-编辑
            deleteOlder: function (index, row) {
                var _this = this;
                _this.$confirm('此操作将永久删除该作业区管理, 是否继续?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(function () {
                    remove(row, _this.warehousingReservation);
                    postDelete(_this, {
                        id: [row.rkdjNo]
                    });
                }).catch(function () {
                    _this.$message({
                        type: 'info',
                        message: '已取消删除'
                    });
                });
            },                                 //TODO 行内按钮-删除
            multiSelectClick: function () {
                this.multiSelect = !this.multiSelect;
            },                                      //多选 状态维护
            multiSelectionChange: function (val, row) {
                this.multipleSelection = val;
            },                          //多选 选中控制
            multiOperationEdit: function () {
                this.inlineEdit(1, this.multipleSelection[0]);
            },                                    //多选 编辑

            handleSizeChange: function (val) {
                /*<debug>*/
                console.log('每页' + val + '条');
                /*</debug>*/
                this.pageSize = val;
                p[0].post( this.option);
            },                                   //分页 Size
            handleCurrentChange: function (val) {
                /*<debug>*/
                console.log('当前第' + val + '页');
                /*</debug>*/
                this.currentPage = val;
                p[0].post( this.option);
            },                                //分页 当前页

            newInput: function () {
                this.form = form();
                this.dialogFormVisible = true;
                this.dialogFormActive = 0;
                Vue.nextTick(function () {
                    operationAreaManage.$refs.carousel.setActiveItem(0);
                });
            },                                              //按钮 新建入库单
            prev: function () {
                this.dialogFormActive--;
                this.$refs.carousel.prev();
            },                                                  //新建 弹出层banner控制 前一个
            next: function () {
                this.dialogFormActive++;
                this.$refs.carousel.next();
            },                                                  //新建 弹出层banner控制 后一个
            submit: function () {
                var _this = this;
                this.dialogFormActive++;
                this.submitLoading = true;
                //TODO 此处应是ajax请求


                /*<prod>*/
                if (this.form.title === '新建仓库') {
                    postSubmit(this, this.form);
                } else {
                    postModify(this, this.form);
                }
                /*</prod>*/
                /*<debug>*/
                setTimeout(function () {
                    _this.submitLoading = false;
                    _this.$notify({
                        title: '成功',
                        message: '保存成功！',
                        type: 'success'
                    });
                    _this.dialogFormVisible = false;
                    _this.dialogFormActive = 0;
                    _this.$refs.carousel.setActiveItem(0);
                    p[0].post();
                }, 1500);
                /*</debug>*/
            },                                                //新建 表单提交

            submitRole: function () {
                var _this = this;
                this.loadingWarehouse = true;

                /*<prod>*/
                //TODO
                postModify(this, this.form);
                /*</prod>*/
                /*<debug>*/
                setTimeout(function () {
                    _this.loadingWarehouse = false;
                    _this.dialogRoleVisible = false;
                    _this.$notify({
                        title: '成功',
                        message: '更换仓库管理成功！',
                        type: 'success'
                    });
                }, 1500);
                /*</debug>*/
            },                                            //新建 表单提交

        },
        watch: {
            blsName: function () {
                /*<debug>*/
                console.log(this.option);
                /*</debug>*/
                p[0].post( this.option);
            }

        }
    });
    //弹出层 form 模板
    function form () {
        return {
            arehouseId: 1,          //仓库id
            title: "新建仓库",
            blsName: '',            //作业区名称
            a: '',                   //库位数
        }
    };
    var obj=operationAreaManage;
    var p=[];
    // 0 作业区管理 分页查询
    p[0] = autoPost({
        urlHock: "../../hock/operationAreaManage/page.json",
        urlProd: "/route/operationAreaManage/0",
        success: function (json) {
            obj.$data.operationAreaManage = json.data;
            obj.$data.currentTotal = json.recordsFiltered
        }
    });

     // 1 作业区管理 储位组管理 新增储位组
    p[1] = autoPost({
        urlHock: "../../hock/operationAreaManage/page.json",
        urlProd: "/route/operationAreaManage/1",
        success: function (json) {
            obj.$data.operationAreaManage = json.data;
            obj.$data.currentTotal = json.recordsFiltered
        }
    });
     // 2 作业区管理 储位组管理 更新储位组信息
    p[2] = autoPost({
        urlHock: "../../hock/operationAreaManage/page.json",
        urlProd: "/route/operationAreaManage/2",
        success: function (json) {
            obj.$data.operationAreaManage = json.data;
            obj.$data.currentTotal = json.recordsFiltered
        }
    });
     // 3 作业区管理 储位组管理 根据id返回储位组信息
    p[3] = autoPost({
        urlHock: "",
        urlProd: "/route/operationAreaManage/3",
        success: function (json) {
            obj.$data.operationAreaManage = json.data;
            obj.$data.currentTotal = json.recordsFiltered
        }
    });
     // 4 作业区管理 储位组管理 通过id删除一条储位组数据';
    p[4] = autoPost({
        urlHock: "",
        urlProd: "/route/operationAreaManage/4",
        success: function (json) {
            obj.$data.operationAreaManage = json.data;
            obj.$data.currentTotal = json.recordsFiltered
        }
    });
      // 5 作业区管理 储位组管理 通过id删除一条储位组数据';
    p[5] = autoPost({
        urlHock: "",
        urlProd: "/route/operationAreaManage/5",
        success: function (json) {
            obj.$data.operationAreaManage = json.data;
            obj.$data.currentTotal = json.recordsFiltered
        }
    });



    // 高级 监视器的 使用方法
    //    operationAreaManage.$watch('date', function () {
    //        if (!this.option.dateStart)return;
    //        /*<debug>*/
    //        console.log(this.option);
    //        /*</debug>*/
    //        post(this, this.option);
    //    }, {deep: true});

    p[0].post( operationAreaManage.option);
</script>